package com.techprimers.mongodb.springbootmongodbexample.mongodb.tester;

import com.techprimers.mongodb.springbootmongodbexample.SpringBootMongodbExampleApplication;
import com.techprimers.mongodb.springbootmongodbexample.document.Users;
import com.techprimers.mongodb.springbootmongodbexample.repository.UserRepository;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;

import javax.annotation.Resource;

@Slf4j
@EnableAutoConfiguration
@SpringBootTest(classes = SpringBootMongodbExampleApplication.class)
public class MongdbBasicTester {

    @Resource
    private UserRepository userRepository;

    @Test
    public void saveDocuments() {
        log.info("Save document to mongodb.");
        userRepository.save(new Users(1, "Peter", "Development", 3000L));
        userRepository.save(new Users(2, "Pig", "Development", 3000L));
    }
}
